× Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Lesson 7 Lesson 8 Lesson 9 Lesson 10 Lesson 11 Lesson 12 Lesson 13 Lesson 14 Lesson 15 Lesson 16 Lesson 17 Lesson 18 Lesson 19 Lesson 20 Lesson 21 Lesson 22 Lesson 23 Lesson 24 Lesson 25 Mini Lesson 1 Mini Lesson 2 Mini Lesson 3 Mini Lesson 4 Mini Lesson 5

Lessons

Mini Lesson 2: Importing Modules

Modules are very important in programming. Which modules that you import into Python are up to you, and they can add certain functions and classes. There are also plenty of built in modules, for example the print() function is one of the built in modules in Python. Here is the basic syntax for importing a module into Python:

import math

With this simple code, we gained access to a wide variety of functions from the math module, such as gcd(), which finds the greatest common divisor of two numbers, and log(), which returns the log of a selected base of a number.

To find all available modules, simply look up "Python 3 modules" and you not only find available modules but also all of the avaiable functions/methods.